*** Settings ***
Library    Selenium2Library
Library    DatabaseLibrary    # 导入数据管理库


*** Keywords ***
浏览器等待时间
    set browser implicit wait  20

打开平台登录页
#    open browser  ${URL}  chrome firefox
    open browser  ${URL}  firefox

窗口最大化
    maximize browser window

连接Oracle
    # 使用cx_oracle连接Oracle数据库，连接配置'用户名','密码','IP:端口/ORCL'
    connect to database using custom params  cx_Oracle  'dhcc25','dhcc250716','172.28.28.168:1521/ORCL'

连接Mysql
    # 使用pymysql连接MySQL数据库
    connect to database using custom params  pymysql
    ...  database='dhcc12',user='dhcc12',password='dhcc120924',host='172.28.28.169',port=3306

断开数据库
    disconnect from database

关闭浏览器
    close browser

输入文本
    [Arguments]  ${ele}  ${text}
    wait until element is visible  ${ele}  5
    input text  ${ele}  ${text}

点击元素
    [Arguments]  ${ele1}
    wait until element is visible  ${ele1}  5
    click element  ${ele1}

选择表单
    [Arguments]  ${ele2}
    wait until element is visible  ${ele2}  5
    select frame  ${ele2}

移动元素到指定坐标
    [Documentation]  通过指定移动像素尺寸（像素）拖动元素,xSize值为正向右移动，ySize值为正向下移动
    [Arguments]  ${ele3}  ${xSize}  ${ySize}
    wait until element is visible  ${ele3}  5
    drag and drop by offset  ${ele3}  ${xSize}  ${ySize}

移动到其他元素坐标
    [Documentation]  通过另一个元素的位置来拖动一个元素到另一个元素位置
    [Arguments]  ${ele4}  ${otherEle}
    wait until element is visible  ${ele4}  5
    wait until element is visible  ${otherEle}  5
    drag and drop  ${ele4}  ${otherEle}

获取文本
    [Arguments]  ${ele5}
    wait until element is visible  ${ele5}  5
    ${text}  get text  ${ele5}
    [Return]  ${text}

获取值
    [Arguments]  ${ele6}
    wait until element is visible  ${ele6}  5
    ${value}  get value  ${ele6}
    [Return]  ${value}

*** Variables ***
#${URL}  http://172.28.30.2:8081/creditplatformweb/login
#${USERNAME}  lee
#${PWD}  111111-a
#${LOGINTESTUSER}  lee02
#${TESTPWD}  111111-Aa
#${ALTERUSER}  li02
#${alterPwd}  Xin888888-
#${newPwd}  Xin999999-

${URL}  http://172.28.30.2:8081/creditplatformweb/login
${USERNAME}  z1
${PWD}  111111-aA
${LOGINTESTUSER}  z2
${TESTPWD}  111111-aA
${ALTERUSER}  zjr
${alterPwd}  111111-aA
${newPwd}  111111-bB